#ifndef _TIMER_HPP_
#define _TIMER_HPP_

#include <chrono>

namespace timer
{
	static std::chrono::time_point<std::chrono::high_resolution_clock> __last_time;

	inline void start()
	{
		__last_time = std::chrono::high_resolution_clock::now();
	}

	inline int64_t stop()
	{
		return std::chrono::duration_cast<std::chrono::milliseconds>(
				   std::chrono::high_resolution_clock::now() - __last_time)
			.count();
	}

	inline int64_t stop_micro()
	{
		return std::chrono::duration_cast<std::chrono::microseconds>(
				   std::chrono::high_resolution_clock::now() - __last_time)
			.count();
	}

	inline int64_t stop_nano()
	{
		return std::chrono::duration_cast<std::chrono::nanoseconds>(
				   std::chrono::high_resolution_clock::now() - __last_time)
			.count();
	}
}

#endif //_TIMER_HPP_